package com.example.day_35.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebAppConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new AuthInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns(
                        "/user/tologin",
                        "/user/login",
                        "/css/**",
                        "/fonts/**",
                        "/images/**",
                        "/js/**",
                        "/lib/**"
//                        "/user/index"
                );

    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
       registry.addResourceHandler("/upload/**")
               .addResourceLocations("file:F:\\ad\\day_35\\src\\main\\resources\\static\\img\\");
    }
}
